// Table 3: Horizontal Dynasties and Spending //

clear all
cap log close

global path ""
use "$path/Main.dta", clear
cd "$path/"

rdbwselect_2014 log_pc_x_totexp margin_rel, bwselect(CCT)
local bw_CCT = e(h_CCT)

rdbwselect_2014 log_pc_x_totexp margin_rel, bwselect(IK)
local bw_IK = e(h_IK)

xtset idcode

** Panel A: Basic Specification **
* Column 1
reg log_pc_x_totexp win, robust cluster(idcode_prov)
estadd ysumm
	
* Column 2
xi: xtreg log_pc_x_totexp win i.year, fe robust cluster(idcode_prov)
estadd ysumm

* Column 3
reg log_pc_x_totexp win mv_1 dmv_1, robust cluster(idcode_prov)
estadd ysumm

* Column 4
xi: xtreg log_pc_x_totexp win mv_1 dmv_1 i.year, fe robust cluster(idcode_prov)
estadd ysumm
	
* Column 5
reg log_pc_x_totexp win mv_1 dmv_1 mv_2 dmv_2, robust cluster(idcode_prov)
estadd ysumm

* Column 6
xi: xtreg log_pc_x_totexp win mv_1 dmv_1 mv_2 dmv_2 i.year, fe robust cluster(idcode_prov)
estadd ysumm

* Column 7
reg log_pc_x_totexp win if abs(margin_rel) <= `bw_CCT', robust cluster(idcode_prov)
estadd ysumm
		
* Column 8
xi: xtreg log_pc_x_totexp win i.year if abs(margin_rel) <= `bw_CCT', fe robust cluster(idcode_prov)
estadd ysumm

* Column 9
reg log_pc_x_totexp win if abs(margin_rel) <= `bw_IK', robust cluster(idcode_prov)
estadd ysumm
		
* Column 10
xi: xtreg log_pc_x_totexp win i.year if abs(margin_rel) <= `bw_IK', fe robust cluster(idcode_prov)
estadd ysumm

** Panel B: Control for Same Party **
* Column 1
reg log_pc_x_totexp win same_party_h1, robust cluster(idcode_prov)
estadd ysumm
	
* Column 2
xi: xtreg log_pc_x_totexp win same_party_h1 i.year, fe robust cluster(idcode_prov)
estadd ysumm

* Column 3
reg log_pc_x_totexp win same_party_h1 mv_1 dmv_1, robust cluster(idcode_prov)
estadd ysumm

* Column 4
xi: xtreg log_pc_x_totexp win same_party_h1 mv_1 dmv_1 i.year, fe robust cluster(idcode_prov)
estadd ysumm
	
* Column 5
reg log_pc_x_totexp win same_party_h1 mv_1 dmv_1 mv_2 dmv_2, robust cluster(idcode_prov)
estadd ysumm

* Column 6
xi: xtreg log_pc_x_totexp win same_party_h1 mv_1 dmv_1 mv_2 dmv_2 i.year, fe robust cluster(idcode_prov)
estadd ysumm

* Column 7
reg log_pc_x_totexp win same_party_h1 if abs(margin_rel) <= `bw_CCT', robust cluster(idcode_prov)
estadd ysumm
		
* Column 8
xi: xtreg log_pc_x_totexp win same_party_h1 i.year if abs(margin_rel) <= `bw_CCT', fe robust cluster(idcode_prov)
estadd ysumm

* Column 9
reg log_pc_x_totexp win same_party_h1 if abs(margin_rel) <= `bw_IK', robust cluster(idcode_prov)
estadd ysumm
		
* Column 10
xi: xtreg log_pc_x_totexp win same_party_h1 i.year if abs(margin_rel) <= `bw_IK', fe robust cluster(idcode_prov)
estadd ysumm
